
<!--navbar-fixed-top-->

<nav class="navbar navbar-default">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
              aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" routerLink="/posts">贾俊松的主页</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li><a routerLink="/posts">Home</a></li>
        <li><a href="http://www.baidu.com">百度</a></li>
        <li><a href="#contact">Contact</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
             aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a [routerLink]="['/writeoreditpost',{id:1}]">/writeoreditpost/1</a></li>
            <li><a routerLink="/writeoreditpost">/writeoreditpost</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li class="dropdown-header">Nav header</li>
            <li><a href="#">Separated link</a></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <ul *ngIf="userService.currentUser==null" class="nav navbar-nav navbar-right">
        <li><a routerLink="/user/login">登录</a></li>
        <li><a routerLink="/user/register">注册</a></li>
      </ul>

      <ul *ngIf="userService.currentUser" class="nav navbar-nav navbar-right">
        <li><a class="" routerLink="/user/userspace">{{userService.currentUser.username}}的个人主页</a>
        </li>
        <li><a class="" routerLink="/user/profile">个人设置</a></li>
        <li><a class="" routerLink="/writeoreditpost">写博客</a></li>
        <li><a href="javascript:void(0);" (click)="logout();">退出</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div>
</nav>


<div class="container" style="margin-top:70px">
  <p>currentUser:{{userService.currentUser | json}}</p>
  <router-outlet></router-outlet>
</div>

